<div class="page-toolbar">
    <div class="layui-btn-group fl">
        <a href="{:url('add')}" class="layui-btn layui-btn-primary"><i class="aicon ai-tianjia"></i>添加</a>
        <a data-href="{:url('del')}" class="layui-btn layui-btn-primary j-page-btns confirm"><i class="aicon ai-jinyong"></i>删除</a>
    </div>
    <div class="page-filter fr">
        <form class="layui-form layui-form-pane" action="{:url()}" method="get" id="hisi-table-search">
        <div class="layui-form-item">
            <label class="layui-form-label">卡号</label>
            <div class="layui-input-inline">
                <input type="text" name="keyword" lay-verify="required" placeholder="请输入校园卡号" autocomplete="off" class="layui-input">
            </div>
            <label class="layui-form-label">状态</label>
            <div class="layui-input-inline">
                <select name="status" class="field-status" type="select">
                    <option value="">请选择状态</option>
                    <option value="0">禁用</option>
                    <option value="1">启用</option>
                </select>
            </div>
            <button type="submit" class="layui-btn layui-btn-warm">搜索</button>
        </div>
        </form>
    </div>
</div>
<table id="dataTable"></table>
{include file="admin@block/layui" /}
<script type="text/html" title="状态模板" id="statusTpl">
    <input type="checkbox" name="status" value="{{ d.status }}" lay-skin="switch" lay-filter="switchStatus" lay-text="启用|禁用" {{ d.status == 1 ? 'checked' : '' }} data-href="{:url('editStatus')}?id={{ d.id }}">
</script>
<script type="text/html" title="操作按钮模板" id="buttonTpl">
    <a href="{:url('edit')}?id={{ d.id }}" class="layui-btn layui-btn-xs layui-btn-normal">修改</a>
    <a href="{:url('del')}?id={{ d.id }}" class="layui-btn layui-btn-xs layui-btn-danger j-tr-del">删除</a>
</script>
<script type="text/javascript">
    layui.use(['table'], function() {
        var table = layui.table, formType = {:json_encode(form_type())};
        table.render({
            elem: '#dataTable'
            ,url: '{:url('')}' //数据接口
            ,page: true //开启分页
            ,limit: 20
            ,text: {
                none : '暂无相关数据'
            }
            ,cols: [[ //表头
                {type:'checkbox'}
                ,{field: 'card_id', title: '校园卡号', width: 250}
                ,{field: 'name', title: '姓名', width: 100}
                ,{field: 'mobile', title: '手机号', width: 200}
                ,{field: 'group', title: '身份', width: 200}
                ,{field: 'status', title: '状态', width: 100,templet: '#statusTpl'}
                ,{field: 'etime', title: '过期时间', width: 200,}
                ,{field: 'count', title: '违规次数', width: 100}
                ,{title: '操作', width: 120, templet: '#buttonTpl'}
            ]]
        });
    });
</script>